﻿<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPageContent.master" AutoEventWireup="false" CodeFile="Accounts.aspx.vb" Inherits="Accounts" %>

<%@ Register Src="~/UserControls/OneFilteredDropDownList.ascx" TagName="OneFilteredDropDownList"
    TagPrefix="uc2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    
    <%--<script language="javascript" type="text/javascript" src="Design/EasyAccounting/niceforms.js"></script>
    <link href="Design/EasyAccounting/niceforms-default.css" rel="stylesheet" type="text/css" />--%>
    
    <style type="text/css">
    .panelCss
    {
    	margin-right:12px;
    	margin-left:8px;
    }
    .ActionsPanel
    {
    	/*margin-right:12px;*/
    	margin-left:8px;
    	-moz-border-radius: 5px 5px 5px 5px;
	    -webkit-border-radius: 5px 5px 5px 5px;
	    border-radius: 5px 5px 5px 5px;
    }
    .btnAdd.rdPadding
    {
    	padding:0px;
    }
    </style>
    <script type="text/javascript">

        function Confirm(sender, args) {

            var DeleteButton = $find("<%=btnDelete.ClientID %>");

            if (confirm('Are You Sure you Want to Delete ?')) {
                DeleteButton.set_autoPostBack(true);
            }
            else
            {
                DeleteButton.set_autoPostBack(false);
                //args.set_cancel(true);
                //sender.set_cancel(true);
            }
        }
    
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">


        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="rtlAccounts">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" />
                        <telerik:AjaxUpdatedControl ControlID="rtlAccounts" LoadingPanelID="RadAjaxLoadingPanel1"/>
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="pnlrtvAccounts">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" />
                        <telerik:AjaxUpdatedControl ControlID="pnlrtvAccounts" LoadingPanelID="RadAjaxLoadingPanel1"/>
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="rtvAccounts">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" />
                        <telerik:AjaxUpdatedControl ControlID="pnlrtvAccounts" LoadingPanelID="RadAjaxLoadingPanel1"/>
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="btnSave">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="rtvAccounts" LoadingPanelID="RadAjaxLoadingPanel1"/>
                        <telerik:AjaxUpdatedControl ControlID="pnlrtvAccounts" LoadingPanelID="RadAjaxLoadingPanel1"/>
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="btnAddRoot">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" />
                        <telerik:AjaxUpdatedControl ControlID="pnlrtvAccounts" LoadingPanelID="RadAjaxLoadingPanel1"/>
                        <telerik:AjaxUpdatedControl ControlID="rtvAccounts" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="btnAdd">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" />
                        <telerik:AjaxUpdatedControl ControlID="pnlrtvAccounts" LoadingPanelID="RadAjaxLoadingPanel1"/>
                        <telerik:AjaxUpdatedControl ControlID="rtvAccounts" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="btnDelete">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="rtvAccounts" LoadingPanelID="RadAjaxLoadingPanel1"/>
                        <telerik:AjaxUpdatedControl ControlID="pnlrtvAccounts" LoadingPanelID="RadAjaxLoadingPanel1"/>
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Sunset" Transparency="0" >
        </telerik:RadAjaxLoadingPanel>

        <telerik:RadWindowManager ID="RadWindowManager1" runat="server">  
        </telerik:RadWindowManager>

        <br /><br />

    <%--<asp:Panel ID="pnlChangeView" Direction="<%$ Resources:SystemResource, PanelDirction %>" runat="server" Visible="true" CssClass="panelCss" >
        
        <table>
            <tr>
                <td>
                <center>
                   <asp:Label ID="lblChangeView" runat="server" meta:ResourceKey="lblChangeView" SkinID="KeyLabel" ></asp:Label>
                    <asp:ImageButton ID="ibtnGridView" runat="server" ToolTip="Grid View" ImageUrl="Design/gridview.png" Width="20px" Height="20px" />
                    <asp:ImageButton ID="ibtnListView" runat="server" ToolTip="List View" ImageUrl="Design/listview.png" Width="20px" Height="20px" />
                </center>
                </td>
            </tr>
        </table>
        
    </asp:Panel>--%>

    <br /><br />


     <!----------------------------------------- Rad Tree View ------------------------------------------>




     

     <%--<div id="divrtvDetails" runat="server" dir="<%$ Resources:SystemResource, PanelDirction %>" Visible="false" CssClass="panelCss" >--%>

     <div class="panelCss">

     <table>
        <tr>

            <td runat="server" id="TDAlignTree" width="500px">
                <telerik:RadTreeView ID="rtvAccounts" runat="server" ValidationGroup="valAccounts"
                        DataValueField = "AccountNo" dir="<%$ Resources:SystemResource, HTMLDirectionality %>"
                            DataFieldID="AccountNo" DataFieldParentID="ParentID" DataTextField="<%$ Resources:SystemResource, Account %>" 
                        DataSourceID="odsAccounts" OnNodeClick="rtvAccounts_NodeClick" >
                </telerik:RadTreeView>
            </td>


            <td valign="top">
                
                <telerik:RadButton ID="btnAddRoot" Font-Size="Small" meta:ResourceKey="btnAddRoot"
                        runat="server" SkinID="AccMetro" >
                </telerik:RadButton> &nbsp;
                <telerik:RadButton ID="btnAdd" meta:ResourceKey="btnAdd" Font-Size="Small" CssClass="rdPadding"
                        runat="server" SkinID="AccMetro" >
                </telerik:RadButton> &nbsp;
                <telerik:RadButton ID="btnDelete" meta:ResourceKey="btnDelete" OnClientClicking="Confirm" Font-Size="Small"
                        runat="server" SkinID="delMetro" >
                </telerik:RadButton>

                <br />
                <asp:Panel ID="pnlrtvAccounts" DefaultButton="btnSave" Direction="<%$ Resources:SystemResource, PanelDirction %>" runat="server" CssClass="ActionsPanel" >  
                <table>
                    <tr>
                        <td runat="server" id="TDAlign1">

                        <br />
                        
                        <div id="divHeader" style="font-size: 16px; line-height: 21px;">
                            
                            <asp:Label ID="lblDetails" runat="server" Font-Bold="true" SkinID="KeyLabel" meta:ResourceKey="lblAccountDetails"></asp:Label>
                            
                            <!--- ID --->
                            <asp:Label ID="lblNodeID" runat="server" Visible="false"></asp:Label>
                            <!--- ID --->

                        </div>
                        <div id="divDetails" style="font-size: 12px; line-height: 21px; ">
                            
                            <asp:Label ID="lblParent" Font-Bold="true" Visible="false" runat="server" meta:ResourceKey="lblParentAcc"></asp:Label>
                            <asp:Label ID="lblParentAcc" Font-Bold="true" Visible="false" runat="server" ></asp:Label>
                            
                            <br />

                            <asp:Label ID="lblManrcbAccountType" runat="server" SkinID="Mandetory" Text="<%$ Resources:Controls, RequiredValidationText %>" ></asp:Label>
                            <asp:Label ID="lblAccountType" Font-Bold="true" runat="server" meta:ResourceKey="lblAccountType" ></asp:Label>
                            
                            <asp:Label runat="server" ID="Type" />
                            <uc2:OneFilteredDropDownList ID="rcbAccountType" Visible="false" runat="server" DataSourceId="odsAccountType"
                            DataValueField="MINOR" IsRequired="true" DataTextField="<%$ Resources:SystemResource, Lookup %>"
                            DefaultChoosedItem="ChooseOne" ValidationGroup="valAccounts" />
                            
                            <br />

                            <asp:Label ID="lblManrtbAccountNumber" runat="server" SkinID="Mandetory" Text="<%$ Resources:Controls, RequiredValidationText %>" ></asp:Label>
                            <asp:Label ID="lblAccountNumber" Font-Bold="true" runat="server" meta:ResourceKey="lblAccountNumber" ></asp:Label>
                            
                            <asp:Label runat="server" ID="Number" />
                            <telerik:RadTextBox runat="server" ID="rtbAccountNumber" Visible="false" ValidationGroup="valAccounts" ></telerik:RadTextBox>
                            <asp:RequiredFieldValidator ID="rfvrtbAccountNumber" runat="server" ControlToValidate="rtbAccountNumber" ErrorMessage="<%$ Resources:Controls, ErrorMessage %>" ValidationGroup="valAccounts"></asp:RequiredFieldValidator>
                            
                            <br />
                            
                            <asp:Label ID="lblManrtbAccountNameEn" runat="server" SkinID="Mandetory" Text="<%$ Resources:Controls, RequiredValidationText %>" ></asp:Label>
                            <asp:Label ID="lblAccountNameEn" Font-Bold="true" runat="server" meta:ResourceKey="lblAccountNameEn"></asp:Label>
                            
                            <asp:Label runat="Server" ID="nameEn" />
                            <telerik:RadTextBox runat="server" ID="rtbAccountNameEn" Visible="false" ValidationGroup="valAccounts" ></telerik:RadTextBox>
                            <asp:RequiredFieldValidator ID="rfvrtbAccountNameEn" runat="server" ControlToValidate="rtbAccountNameEn" ErrorMessage="<%$ Resources:Controls, ErrorMessage %>" ValidationGroup="valAccounts"></asp:RequiredFieldValidator>

                            <br />

                            <asp:Label ID="lblManrtbAccountNameAr" runat="server" SkinID="Mandetory" Text="<%$ Resources:Controls, RequiredValidationText %>" ></asp:Label>
                            <asp:Label ID="lblAccountNameAr" Font-Bold="true" runat="server" meta:ResourceKey="lblAccountNameAr" ></asp:Label>
                            
                            <asp:Label runat="Server" ID="nameAr" />
                            <telerik:RadTextBox runat="server" ID="rtbAccountNameAr" Visible="false" ValidationGroup="valAccounts" ></telerik:RadTextBox>
                            <asp:RequiredFieldValidator ID="rfvrtbAccountNameAr" runat="server" ControlToValidate="rtbAccountNameAr" ErrorMessage="<%$ Resources:Controls, ErrorMessage %>" ValidationGroup="valAccounts"></asp:RequiredFieldValidator>

                            <br />

                            <asp:Label ID="lblAccountRemarks" Font-Bold="true" runat="server" meta:ResourceKey="lblAccountRemarks" ></asp:Label>
                        
                            <asp:Label runat="server" ID="Remarks" />
                            <telerik:RadTextBox runat="server" TextMode="MultiLine" Columns="30" Rows="3" ID="rtbAccountRemarks" Visible="false" ></telerik:RadTextBox>
                            <br />
                        
                        </div>
                        </td>
                        </tr>
                        <tr>
                        <td colspan="2" runat="server" id="TDAlign2">
                        <div id="divActions">
                            
                            <telerik:RadButton ID="btnSave" meta:ResourceKey="btnSave" Visible="false" CausesValidation="true" ValidationGroup="valAccounts"
                                runat="server" >
                            </telerik:RadButton>
                            <telerik:RadButton ID="btnEdit" meta:ResourceKey="btnEdit" 
                                runat="server" >
                            </telerik:RadButton>
                            <telerik:RadButton ID="btnCancel" meta:ResourceKey="btnCancel" Visible="false" runat="server" CausesValidation="False"
                                >
                            </telerik:RadButton>

                            
                        </div>

                    </td>
                </tr>
            </table>
            </asp:Panel>
            </td>

        </tr>
        <tr>
            <td>
                &nbsp;
            </td>
        </tr>
     </table>

     </div>

     <%--</div>--%>


     <br /><br />


     <!----------------------------------------- Data Source ------------------------------------------>


     <asp:ObjectDataSource ID="odsAccounts" runat="server" 
    DeleteMethod="QueryDatabase" InsertMethod="QueryDatabase" 
    SelectMethod="QueryDatabase" TypeName="AccountsSP" 
    UpdateMethod="QueryDatabase" >
            <DeleteParameters>
                <asp:Parameter DefaultValue="0" Name="QueryType" Type="Object" />
                <asp:Parameter DefaultValue="deleteAccount" Name="Operation" Type="String" />
                <%--<asp:Parameter Name="ID" Type="String" />--%>
                <asp:Parameter Name="AccountNo" Type="String" />
                <asp:Parameter Name="AccountNameAr" Type="String" />
                <asp:Parameter Name="AccountNameEn" Type="String" />
                <asp:Parameter Name="ParentID" Type="String" />
                <asp:Parameter Name="Remarks" Type="String" />
                <asp:Parameter Name="AccountType" Type="String" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter DefaultValue="0" Name="QueryType" Type="Object" />
                <asp:Parameter DefaultValue="saveAccount" Name="Operation" Type="String" />
                <%--<asp:Parameter Name="ID" Type="String" />--%>
                <asp:Parameter Name="AccountNo" Type="String" />
                <asp:Parameter Name="AccountNameAr" Type="String" />
                <asp:Parameter Name="AccountNameEn" Type="String" />
                <asp:Parameter Name="ParentID" Type="String" />
                <asp:Parameter Name="Remarks" Type="String" />
                <asp:Parameter Name="AccountType" Type="String" />
            </InsertParameters>
            <SelectParameters>
                <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
                <asp:Parameter DefaultValue="rtvAccounts" Name="Operation" Type="String" />
                <%--<asp:Parameter Name="ID" Type="String" />--%>
                <asp:Parameter Name="AccountNo" Type="String" />
                <asp:Parameter Name="AccountNameAr" Type="String" />
                <asp:Parameter Name="AccountNameEn" Type="String" />
                <asp:Parameter Name="ParentID" Type="String" />
                <asp:Parameter Name="Remarks" Type="String" />
                <asp:Parameter Name="AccountType" Type="String" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter DefaultValue="0" Name="QueryType" Type="Object" />
                <asp:Parameter DefaultValue="UpdateAccount" Name="Operation" Type="String" />
                <%--<asp:Parameter Name="ID" Type="String" />--%>
                <asp:Parameter Name="AccountNo" Type="String" />
                <asp:Parameter Name="AccountNameAr" Type="String" />
                <asp:Parameter Name="AccountNameEn" Type="String" />
                <asp:Parameter Name="ParentID" Type="String" />
                <asp:Parameter Name="Remarks" Type="String" />
                <asp:Parameter Name="AccountType" Type="String" />
            </UpdateParameters>
    </asp:ObjectDataSource>


    <asp:ObjectDataSource ID="odsAccountType" runat="server" SelectMethod="QueryDatabase"
        TypeName="DBlookup_tableSP">
        <SelectParameters>
            <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
            <asp:Parameter DefaultValue="RtvAccountType" Name="Operation" Type="String" />
            <asp:Parameter Name="MAJOR" Type="String" />
            <asp:Parameter Name="MINOR" Type="String" />
            <asp:Parameter Name="DescriptionAr" Type="String" />
            <asp:Parameter Name="DescriptionEn" Type="String" />
            <asp:Parameter Name="OrderID" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>


</asp:Content>

